package com.IntelligentCommunity.es.api.factory;

import com.IntelligentCommunity.common.core.domain.R;
import com.IntelligentCommunity.es.api.RemoteEsMatchingDataService;
import com.IntelligentCommunity.es.domain.vo.EsDocInsertVo;
import com.IntelligentCommunity.es.domain.vo.EsDocQueryVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @Author：作者姓名
 * @Package：com.IntelligentCommunity.es.factory
 * @Project：IntelligentCommunity
 * @name：RemoteEsDocFallbackFactory
 * @Date：2024/7/18 22:41
 */
@Component
@Log4j2
public class RemoteEsMatchingDataFallbackFactory implements FallbackFactory<RemoteEsMatchingDataService> {

    @Override
    public RemoteEsMatchingDataService create(Throwable cause) {
        return new RemoteEsMatchingDataService() {
            @Override
            public R<Boolean> insertCaptureData(List<EsDocInsertVo> esDocInsertVo) {
                return R.fail("es人脸匹配信息插入失败");
            }

            @Override
            public R<Boolean> insertCarMatchingData(List<EsDocInsertVo> esDocInsertVo) {
                return R.fail("es汽车匹配信息插入失败");
            }

            @Override
            public R<List<Map>> selectCaptureData(EsDocQueryVo esDocQueryVo) {
                return R.fail("es查询汽车匹配信息失败");
            }

            @Override
            public R<List<Map>> selectDoorAll(EsDocQueryVo esDocQueryVo) {
                return R.fail("es查询门信息失败");
            }
        };
    }
}
